package git.jas0nch.boottest.dao.Impl;

import git.jas0nch.boottest.pojo.Department;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * boottest
 *
 * @author: git.jas0nch
 * date: 2021-11-01
 */

@Component
public class DepartmentDao {
    private static Map<String, Department> sql_map_departments = null;
    static {
        sql_map_departments = new HashMap<>();
        //
        sql_map_departments.put("1",new Department("1","生活部"));
        sql_map_departments.put("2",new Department("2","财务部"));
        sql_map_departments.put("3",new Department("3","消防部"));
        sql_map_departments.put("4",new Department("4","信安部"));
        sql_map_departments.put("5",new Department("5","后勤部"));
    }

    public DepartmentDao() {
    }

    // get
    Collection<Department> getDepartments(){
        return sql_map_departments.values();
    }
    // get by id;
    Department getDepartmentById(String id){
        return sql_map_departments.get(id);
    }
}
